package com.newer.his.common.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.newer.his.common.entity.Role;

@Mapper
public interface RoleMapper {
	@Options(useGeneratedKeys = true, 
			keyColumn = "role_id", 
			keyProperty = "id")
	@Insert("insert into role(rname) values(#{rname})")
	void save(Role role);
	
	@Select("select role_id, rname from role where role_id=#{id}")
	Role findbyId(int id);
	
	@Select("select role_id, rname from role")
	List<Role> findAll();
	
	
	@Update("update role set rname=#{rname} where role_id=#{id}")
	void update (Role role);
	
	
	@Delete("delete from role where role_id=#{id}")
	void delete(int id);
	 
	
	

}
